// Injection PNLF Brightness Level
// Author: tsln1998@gmail.com


DefinitionBlock("", "SSDT", 2, "hack", "BACKLIGHT", 0)
{
    External(_SB.PCI0.GFX0, DeviceObj)
    
    External(_SB.PCI0.GFX0.DD1F._BCL, MethodObj)
    External(_SB.PCI0.GFX0.DD1F._BQC, MethodObj)
    External(_SB.PCI0.GFX0.DD1F._BCM, MethodObj)
    External(_SB.PCI0.GFX0._DOS, MethodObj)
    
    Device (_SB.PCI0.GFX0.PNLF)
    {
        Name (_ADR, Zero)
        Name (_HID, EisaId ("APP0002"))
        Name (_CID, "backlight")
        Name (_UID, 10)
        Name (_STA, 0x0B)
        // Brightness Level fix
        Method (_BCL, 0, NotSerialized)
        {
            Return (\_SB.PCI0.GFX0.DD1F._BCL())   
        }
        
        // Brightness Query Current
        Method (_BQC, 0, NotSerialized)
        {
            Return (\_SB.PCI0.GFX0.DD1F._BQC())   
        }    
    
        // Brightness Control Method 
        Method (_BCM, 0, NotSerialized)
        {
            Return (\_SB.PCI0.GFX0.DD1F._BCM())   
        }    
    
        // Disable Output Switch 
        Method (_DOS, 0, NotSerialized)
        {
            Return (\_SB.PCI0.GFX0._DOS())   
        } 
          
        // XBCM -> _BCM
        Method (XBCM, 0, NotSerialized)
        {
            Return (_BCM())
        }
    
        // XBQC -> _BQC
        Method (XBQC, 0, NotSerialized)
        {
            Return (_BQC())
        }
    
        Name (XOPT, Zero) // define to 1 can disable smooth   
         
        // Define valid range
        Method (XRGL, 0, NotSerialized)
        {
            Store(_BCL(), Local0)
            Store(DerefOf(Index(Local0, 2)), Local0)
            Return(Local0)
        }
    
        // Define valid range
        Method (XRGH, 0, NotSerialized)
        {
            Store(_BCL(), Local0)
            Store(DerefOf(Index(Local0, Subtract(SizeOf(Local0), 1))), Local0)
            Return(Local0)
        }
    
    }   
}